import com.jianjian.service.BrandService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * @author Zsir
 * @create 2021-12-12 18:38
 */
public class Test {
    @org.junit.jupiter.api.Test
    public void test1() throws SQLException {
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(SpringConfiguration.class);
        BrandService service = (BrandService) applicationContext.getBean("BrandService");
        service.life();
        DataSource dataSource = (DataSource) applicationContext.getBean("dataSource");
        Connection connection = dataSource.getConnection();
        System.out.println(connection);
    }

}
